import request from '@/utils/request'

export function query(params) {
    return request({
      url: '/goods/query',
      method: 'get',
      params:params
    })
}

export function changeStatus(id, status) {
    return request({
      url: '/goods/changeStatus',
      method: 'get',
      params:{id,status}
    })
}

export function deleteGoods(id) {
  return request({
    url: '/goods/delete',
    method: 'get',
    params:{id:id}
  })
}

export function submitFormData(goodsInfo) {
  return request({
    url: '/goods/add',
    method: 'post',
    contentType: 'application/json',
    data:{
      languageCode: goodsInfo.languageCode,
      title:goodsInfo.title,
      subtitle:goodsInfo.subtitle,          
      goodsName: goodsInfo.goodsName,
      imageList:goodsInfo.imageList,
      content: goodsInfo.content,
      link: goodsInfo.link,
      status:goodsInfo.status
    }
  })
}

 
//图片上传接口
export function uploadImg(data) {
  return request({
    url: '/goods/uploadImg',
    method: 'post',
    data
  })
}

export function updateGoods(data) {
  return request({
    url: '/goods/update',
    method: 'post',
    data
  })
}

export function exportExcel(params) {
  return request({
    url: '/goods/exportExcel',
    method: 'get',
    responseType: 'blob',
    params:params
  })
} 